package com.dcivision.dms.web;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionMapping;

import com.dcivision.dms.bean.DmsRetentionSetup;
import com.dcivision.framework.ApplicationException;
import com.dcivision.framework.TextUtility;
import com.dcivision.framework.bean.AbstractBaseObject;
import com.dcivision.framework.web.AbstractActionForm;

public class MaintRetentionPeriodSetupForm extends AbstractActionForm{
	public static final String REVISION = "$Revision: 1.3 $";
	
	private String objectType = "";
	private String objectID = "";
	private String periodYear = "";
	private String periodMonth = "";
	private String periodDay = "";
	private String offset = "";
	private String actionName = "";
	private String description = "";
	private String profile = "";
	private String priority = "";
	
	public void setFormData(AbstractBaseObject baseObj) throws ApplicationException {
		DmsRetentionSetup bean = (DmsRetentionSetup)baseObj;
		this.setActionName(bean.getActionName());
		this.setObjectType(bean.getObjectType());
		this.setObjectID(TextUtility.formatIntegerObj(bean.getObjectID()));
		this.setPeriodYear(TextUtility.formatIntegerObj(bean.getPeriodYear()));
		this.setPeriodMonth(TextUtility.formatIntegerObj(bean.getPeriodMonth()));
		this.setPeriodDay(TextUtility.formatIntegerObj(bean.getPeriodDay()));
		this.setDescription(bean.getDescription());
		this.setOffset(bean.getOffset());
		this.setPriority(bean.getPriority());
		this.setID(TextUtility.formatIntegerObj(bean.getID()));
		this.setRecordStatus(bean.getRecordStatus());
    this.setUpdateCount(TextUtility.formatIntegerObj(bean.getUpdateCount()));
    this.setCreatorID(TextUtility.formatIntegerObj(bean.getCreatorID()));
    this.setCreateDate(formatTimestamp(bean.getCreateDate()));
    this.setUpdaterID(TextUtility.formatIntegerObj(bean.getUpdaterID()));
    this.setUpdateDate(formatTimestamp(bean.getUpdateDate()));
	}

	public AbstractBaseObject getFormData() throws ApplicationException {
		DmsRetentionSetup bean = new DmsRetentionSetup();
		bean.setID(TextUtility.parseIntegerObj(this.getID()));
		bean.setObjectID(TextUtility.parseIntegerObj(this.getObjectID()));
		bean.setObjectType(this.getObjectType());
		bean.setPeriodYear(TextUtility.parseIntegerObj(this.getPeriodYear()));
		bean.setPeriodMonth(TextUtility.parseIntegerObj(this.getPeriodMonth()));
		bean.setPeriodDay(TextUtility.parseIntegerObj(this.getPeriodDay()));
		bean.setDescription(this.getDescription());
		bean.setActionName(this.getActionName());
		bean.setOffset(this.getOffset());
		bean.setPriority(this.getPriority());
		bean.setID(TextUtility.parseIntegerObj(this.getID()));
		bean.setRecordStatus(this.getRecordStatus());
		bean.setUpdateCount(TextUtility.parseIntegerObj(this.getUpdateCount()));
		bean.setCreatorID(TextUtility.parseIntegerObj(this.getCreatorID()));
		bean.setCreateDate(parseTimestamp(this.getCreateDate()));
		bean.setUpdaterID(TextUtility.parseIntegerObj(this.getUpdaterID()));
		bean.setUpdateDate(parseTimestamp(this.getUpdateDate()));
		return bean;
	}

	public void reset(ActionMapping mapping, HttpServletRequest request) {
    super.reset(mapping, request);
    this.setActionName("");
		this.setPeriodYear("");
		this.setPeriodMonth("");
		this.setPeriodDay("");
		this.setDescription("");
		this.setOffset("");
		this.setPriority("");
		this.setID("");
  }
	
	public String getActionName() {
		return actionName;
	}

	public void setActionName(String actionName) {
		this.actionName = actionName;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getObjectID() {
		return objectID;
	}

	public void setObjectID(String objectID) {
		this.objectID = objectID;
	}

	public String getObjectType() {
		return objectType;
	}

	public void setObjectType(String objectType) {
		this.objectType = objectType;
	}

	public String getOffset() {
		return offset;
	}

	public void setOffset(String offset) {
		this.offset = offset;
	}

	public String getPeriodDay() {
		return periodDay;
	}

	public void setPeriodDay(String periodDay) {
		this.periodDay = periodDay;
	}

	public String getPeriodMonth() {
		return periodMonth;
	}

	public void setPeriodMonth(String periodMonth) {
		this.periodMonth = periodMonth;
	}

	public String getPeriodYear() {
		return periodYear;
	}

	public void setPeriodYear(String periodYear) {
		this.periodYear = periodYear;
	}

	public String getProfile() {
		return profile;
	}

	public void setProfile(String profile) {
		this.profile = profile;
	}

	public String getPriority() {
		return priority;
	}

	public void setPriority(String priorrity) {
		this.priority = priorrity;
	}
}
